﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace RequestManagerService
{
    public class ReportsService : IReportsService
    {
        public IEnumerable<Report> RetrieveListOfAllReports()
        {
            return new List<Report>
                { 
                new Report { Name = "report1" , CreationDate = new DateTime(2013,11, 1)},
                new Report { Name = "report2" , CreationDate = new DateTime(2013,11, 2)},
                new Report { Name = "report3" , CreationDate = new DateTime(2013,11, 3)}};
        }


        public string RetrieveEnvironment()
        {
            return Properties.Settings.Default.Environment;
        }


        public string RetrieveCallingUser()
        {
            if (ServiceSecurityContext.Current != null)
            {
               
                    return ServiceSecurityContext.Current.WindowsIdentity.Name;
               
            }
            else
            {
                //If security mode is None, System.ServiceModel.ServiceSecurityContext.Current will be null.
                return "No ServiceSecurityContext.Current";
            }
        }
    }
}
